function go_back(){
	var lastUrl = document.referrer;
	if (!/(\/[L|l]ogin){2}/.test(lastUrl))
	{
		window.location.href = lastUrl
	}
}
function go_to(){
	window.location.href="";
}
//底部导航栏
$(document).ready(function(){
	$('.btn').click(function(){
		$(this).find('.list').toggle();
        $(this).siblings('.btn').find('.list').hide();
	});
	$('.nav').siblings().click(function(){
		$('.list').hide();
	});
		
 $('.new li:last').css({ borderBottom: "none"});
 $('.about_myself li:last').css({ borderBottom: "none"});
});


//功能调试中
function debug(msg){
	layer.open({
		content:msg
	});
}

/**
 * 手机号验证
 */
function isMobile(mobile){
	var reg = /^((\(\d{2,3}\))|(\d{3}\-))?1[3|4|5|7|8]\d{9}$/;
	if(!reg.test(mobile)){
        return false;
    }
	return true;
}

//视频适应
	function video_adapt(){
		//视频重新宽度
		$.each($('iframe'), function(i, n){
			var judge_iframe_video  = $('iframe').eq(i).hasClass('video_iframe');
			if(judge_iframe_video){
				var video = $('iframe').eq(i).attr('data-src');
				
				if(video == '' || video == undefined){
					video = $('iframe').eq(i).attr('src');
				}
				var width = $(window).width() - 30;
				//原来的宽度，高度，获取比例
				var old_width  = $('iframe').eq(i).attr('width');
				var old_height = $('iframe').eq(i).attr('height');
				var date_rate  = (old_height / old_width);
				//获取适应屏幕的高度
				var height     = width * date_rate;
				var video_url = video.replace('preview.html','player.html');
				video_url = video_url.replace(/width=(\d|\.)+&/,'width='+width+'&');
				video_url = video_url.replace(/height=(\d|\.)+&/,'height='+height+'&');
				
				$('iframe').eq(i).attr('src',''+video_url+'');
				$('iframe').eq(i).css('height',height);
			}
		});
	}
	
	//控制视频宽度
	function iframe_control(){
		
		$.each($('iframe'), function(i, n){
			var width = $(window).width();
			$('iframe').eq(i).css('width',width - 17);

			//调整视频宽高
			var video = $('iframe').eq(i).attr('src');

			if(video == undefined){
				video = $('iframe').eq(i).attr('data-src');
			}
				
				
			if(video != undefined){
				var width = $(window).width() - 30;
				// //原来的宽度，高度，获取比例
				var old_width  = $('iframe').eq(i).attr('width');
				var old_height = $('iframe').eq(i).attr('height');
				var date_rate  = (old_height / old_width);
		
				// //获取适应屏幕的高度
				var height     = width * date_rate;
				var video_url = video.replace('preview.html','player.html');
				video_url = video_url.replace(/width=(\d|\.)+&/,'width='+width+'&');
				video_url = video_url.replace(/height=(\d|\.)+&/,'height='+height+'&');
				
				$('iframe').eq(i).css('height','none');
				$('iframe').eq(i).attr('src',''+video_url+'');
				$('iframe').eq(i).attr('height',height);
				var style = $('iframe').eq(i).attr('style');
	
				style = style+'height:'+height+'px !important;';
				$('iframe').eq(i).attr('style',style);
				$('iframe').eq(i).attr('width',width);
				//$('iframe').parent().find("*").css("height",height);
			}
		});
		
		$.each($('embed'), function(i, n){
			var width = $(window).width();
			$('embed').eq(i).css('width',width - 17);
		});
		
	}

	/*
	 * 统一弹出框
	 * @param array msg 返回数据(info,status,url)
	 *
	 */
	function open_layer(msg){
		if(msg.status == 1){
			layer.open({
				content:msg.info,
				end:function(){
				   window.location.href = msg.url;
				}
			});
		}else{
			layer.open({
				content:msg.info
			});
			return false;
		}
		return false;
	}
	